import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  // 开启跨域请求
  app.enableCors();
  // 全局的url前缀
  app.setGlobalPrefix('api');


  const config = new DocumentBuilder()
    .setTitle('e2e后台')
    .setDescription('e2e后台 API')
    .setVersion('0.1')
    .build();

  const document = SwaggerModule.createDocument(app, config);
  SwaggerModule.setup('api', app, document);
  await app.listen(3000);
  console.log('项目已启动, 端口: 3000');
}
bootstrap();
